package com.example.demo1;

import java.util.Scanner;

public class NextDate {
    public static void main(String args[]){
        int y=0,m=0,d=0;
        Scanner input1 =new Scanner(System.in);
        Scanner input2 =new Scanner(System.in);
        Scanner input3 =new Scanner(System.in);
        y=input1.nextInt();
        m=input1.nextInt();
        d=input1.nextInt();
        if((y>=1912 && y<=2112) && (m>=1 && m<=31)&&(d>=1 && d<=31)){
            d++;
            if(m==1||m==3||m==5||m==7||m==8||m==10||m==12){
                if(d<=31){
                    System.out.println(y+"年"+m+"月"+"第"+d+"天");
                }
                else{
                    if(m==12){
                        y++;
                        m=1;
                        d=d-31;
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                    else{
                        m++;
                        d=d-31;
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                }
            }
            else if(m==4||m==6||m==9||m==11){
                if(d<=30){
                    System.out.println(y+"年"+m+"月"+"第"+d+"天");
                }
                else{
                    m++;
                    d=d-30;
                    System.out.println(y+"年"+m+"月"+"第"+d+"天");
                }
            }
            else{
                if(y % 100==0 && y % 400 ==0 || y % 100!=0 && y % 4 ==0){
                    if(d<=29){
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                    else{
                        m++;
                        d=d-29;
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                }
                else{
                    if(d<=28){
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                    else{
                        m++;
                        d=d-28;
                        System.out.println(y+"年"+m+"月"+"第"+d+"天");
                    }
                }
            }

        }
        else{
            System.out.println("年份有问题");
        }
    }
}
